<include file="Public/header" />
  
  <body>
  <div class="layui-container" style="margin-top: 10px;">
    <div class="layui-row">
      <div class="layui-col-md12">        
        <form class="layui-form" >
            <div class="layui-form-item">
              <label class="layui-form-label">帐号</label>
              <div class="layui-input-block">
                <input type="text" name="tname" required  lay-verify="required" placeholder="请输入帐号" autocomplete="off" class="layui-input" value="<{$te.tname}>" id="tname">
              </div>
            </div>
            <div class="layui-form-item">
              <label class="layui-form-label">姓名</label>
              <div class="layui-input-block">
                <input type="text" name="truename" required  lay-verify="required" placeholder="请输入真实姓名" autocomplete="off" class="layui-input" value="<{$te.truename}>" id="truename">
              </div>
            </div>
            <div class="layui-form-item">
              <label class="layui-form-label">密码</label>
              <div class="layui-input-inline">
                <input type="password" name="pass" placeholder="请输入密码" autocomplete="off" class="layui-input" value="<{$te.pass}>" id="tpass">
              </div>
              <div class="layui-form-mid layui-word-aux">如需要修改请删除后修改</div>
            </div>
            <div class="layui-form-item">
              <label class="layui-form-label">学校</label>
              <div class="layui-input-block">
                <select name="schoolid" lay-verify="required" id="schoolid">
                  <option value="<{$te.schoolid}>"><{$te.schoolid|getschool}></option>
                  <if condition="$Think.session.type eq 2 ">
                  <option value="1">孝义中学</option>
                  <option value="2">孝义二中</option>
                  <option value="3">孝义三中</option>
                  <option value="4">孝义四中</option>
                  <option value="5">孝义五中</option>
                  <option value="6">孝义实验中学</option>
                  <option value="7">孝义华杰中学</option>
                  <option value="8">孝义艺苑中学</option>
                  <option value="0">教育局</option>
                  </if>
                </select>
              </div>
            </div>
            <div class="layui-form-item">
              <label class="layui-form-label">权限</label>
              <div class="layui-input-block">
                <select name="schoolid" lay-verify="required" id="type">
                  <option value="<{$te.type}>"><{$te.type|get_type}></option>
                   <if condition="$Think.session.type eq 2 ">
                  <option value="0">管理员（班主任）</option>
                  <option value="1">学校管理员</option>
                  <option value="2">超级管理员</option>
                  <else />
                  <option value="0">管理员（班主任）</option>
                  <option value="1">学校管理员</option>
                  </if>
                </select>
              </div>
            </div>
            <div class="layui-form-item">
              <div class="layui-input-block">
              <!-- <a class="layui-btn" href="javascript:;" lay-submit onclick="sub('<{$te.tid}>')">立即提交</a> -->
              <!-- <button class="layui-btn" lay-submit onsubmit="sub('<{$te.tid}>')">立即提交</button> -->
                <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                <!-- <button type="reset" class="layui-btn layui-btn-primary">重置</button> -->
              </div>
            </div>
          </form>
        </div>
    </div>
</div> 
<script>

//Demo
layui.use('form', function(){
  var form = layui.form;
  
  //监听提交
  form.on('submit(formDemo)', function(){
    // layer.msg(JSON.stringify(data.field));
    //alert(data.field.tname);
    var tid='<{$te.tid}>',tname=$('#tname').val(),truename=$('#truename').val(),pass=$('#tpass').val(),type=$('#type').val(),schoolid=$('#schoolid').val();
    //alert(tname);
    $.post("<{:U('do_tedit')}>",{tid:tid,tname:tname,truename:truename,pass:pass,schoolid:schoolid,type:type},function(data,status){
          //alert("Data: " + data + "\nStatus: " + status);
          if (data >= 1) {
            layer.msg('修改成功!',{icon: 6,time:2000});
            setTimeout("x_admin_close()",1000);
            setTimeout("window.parent.location.reload()",1000);
          } else{
            layer.msg('还是用旧的好！',{icon: 5,time:1000});
            //x_admin_close();
          } 
      });
    return false;
  });
});

</script>
</body>
</html>